// 获取全局应用实例
const app = getApp();

Page({
  data: {
    totalStudyHours: 120,
    longestStreak: 21,
    dateRange: ['本周', '本月', '本年'],
    dateIndex: 0,
    subjectData: [
      { name: '英语', weekPercent: 30, total: 20 },
      { name: '数学', weekPercent: 40, total: 30 },
      { name: '专业课', weekPercent: 50, total: 40 },
      { name: '政治', weekPercent: 20, total: 10 }
    ],
    theme: {}
  },

  onLoad() {
    const app = getApp();
    this.setData({ theme: app.globalData.theme });
  },

  changeDateRange(e) {
    this.setData({
      dateIndex: e.detail.value
    });
  }
});